<!--  住院病人点评-->
<!--  InpatientReview-->
<template>
  <div class="wrapper">
    <div class="main-message">
      <!--      按钮区域-->
      <div class="btn-layout">
        <div>
          <el-button size="mini" type="primary" @click="getPrescPatList">筛选</el-button>
          <el-button size="mini" type="success" @click="showSaveTaskList">任务管理</el-button>
        </div>
      </div>
      <div class="card-layout">
        <div class="left">
          <card>
            <div slot="cardHeader">基本信息</div>
            <div slot="cardBody">
              <!--                出院时间-->
              <div class="content-item">
                <div class="content-item-title">出院时间:</div>
                <div class="content-item-component">
                  <el-date-picker
                    ref="startTime"
                    v-model="queryInfo.startTime"
                    value-format="yyyy-MM-dd"
                    format="yyyy-MM-dd"
                    style="width: 140px"
                    type="date"
                    placeholder="选择日期"
                  />
                </div>
                <div style="line-height: 40px;font-size: 12px;padding: 0 4px">至</div>
                <el-date-picker
                  ref="endTime"
                  v-model="queryInfo.endTime"
                  value-format="yyyy-MM-dd"
                  format="yyyy-MM-dd"
                  style="width: 140px"
                  type="date"
                  placeholder="选择日期"
                />
              </div>
              <!--                就诊类型-->
              <div class="content-item">
                <div class="content-item-title">就诊类型:</div>
                <div class="content-item-component-checkbox">
                  <el-checkbox v-model="queryInfo.LeaveHos" true-label="1" false-label="">出院</el-checkbox>
                  <el-checkbox v-model="queryInfo.InHos" true-label="1" false-label="">在院</el-checkbox>
                </div>
              </div>
              <!--                点评结果-->
              <div class="content-item">
                <div class="content-item-title">点评结果:</div>
                <div class="content-item-component-checkbox">
                  <el-checkbox v-model="queryInfo.notComments" true-label="1" false-label="">未点评</el-checkbox>
                  <el-checkbox v-model="queryInfo.notCommentsTrue" true-label="1" false-label="">点评合理</el-checkbox>
                  <el-checkbox v-model="queryInfo.notCommentsFalse" true-label="1" false-label="">点评不合理</el-checkbox>
                </div>
              </div>
              <!--                点评人-->
              <div class="content-item">
                <div class="content-item-title">点评人:</div>
                <div class="content-item-component">
                  <el-input v-model="queryInfo.commentsUser" />
                </div>
              </div>
              <!--                住院科室-->
              <div class="content-item">
                <div class="content-item-title">住院科室:</div>
                <div class="content-item-component">
                  <el-input v-model="queryInfo.depeName" readonly="true" />
                </div>
                <div class="content-item-btns">
                  <el-button size="mini" type="primary" @click="selectPop('科室')">选择</el-button>
                  <el-button size="mini" type="danger" @click="clearhandleGetDept">清除</el-button>
                </div>
              </div>
              <!--                主管医生-->
              <div class="content-item">
                <div class="content-item-title">主管医生:</div>
                <div class="content-item-component">
                  <el-input v-model="queryInfo.doctorName" readonly="true" />
                </div>
                <div class="content-item-btns">
                  <el-button size="mini" type="primary" @click="selectPop('医生')">选择</el-button>
                  <el-button size="mini" type="danger" @click="clearhandleGetDoctor">清除</el-button>
                </div>
              </div>
              <!--                医生级别-->
              <div class="content-item">
                <div class="content-item-title">医生级别:</div>
                <div class="content-item-component-checkbox">
                  <el-checkbox v-model="queryInfo.doctorRD" true-label="1" false-label="">住院医师</el-checkbox>
                  <el-checkbox v-model="queryInfo.doctorAD" true-label="1" false-label="">主治医师</el-checkbox>
                  <el-checkbox v-model="queryInfo.doctorAP" true-label="1" false-label="">副主任医师</el-checkbox>
                  <el-checkbox v-model="queryInfo.doctorCP" true-label="1" false-label="">主任医师</el-checkbox>
                </div>
              </div>
              <!--                费别-->
              <div class="content-item">
                <div class="content-item-title">费别:</div>
                <div class="content-item-component">
                  <el-input clearable v-model="queryInfo.payClass" />
                </div>
              </div>
              <!--                病人姓名-->
              <div class="content-item">
                <div class="content-item-title">病人姓名:</div>
                <div class="content-item-component">
                  <el-input clearable v-model="queryInfo.patientName" />
                </div>
              </div>
              <!--                性别-->
              <div class="content-item">
                <div class="content-item-title">性别:</div>
                <div class="content-item-component-checkbox">
                  <el-checkbox v-model="queryInfo.feMale" true-label="1" false-label="">女</el-checkbox>
                  <el-checkbox v-model="queryInfo.Male" true-label="1" false-label="">男</el-checkbox>
                </div>
              </div>
              <!--                病人年龄-->
              <div class="content-item">
                <div class="content-item-title">病人年龄:</div>
                <div class="content-item-component">
                  <el-input v-model="queryInfo.startAge" type="number" style="width: 140px" />
                </div>
                <div style="line-height: 40px;font-size: 12px;padding: 0 4px">至</div>
                <el-input v-model="queryInfo.endAge" type="number" style="width: 140px" />
                <div style="line-height: 40px;font-size: 12px;padding: 0 4px">岁</div>
              </div>

              <!--                住院号-->
              <div class="content-item">
                <div class="content-item-title">住院号:</div>
                <div class="content-item-component">
                  <el-input v-model="queryInfo.inpNo" clearable />
                </div>
                <!--                <div class="content-item-btns">-->
                <!--                  <el-button size="mini" type="primary" >导入</el-button>-->
                <!--                  <el-button size="mini" type="danger" @click="clearhandleinpNo">清除</el-button>-->
                <!--                </div>-->
              </div>

              <!--                诊断-->
              <div class="content-item">
                <div class="content-item-title">诊断:</div>
                <div class="content-item-component">
                  <el-input v-model="queryInfo.DiseaseName" readonly="true" />
                </div>
                <div class="content-item-btns">
                  <el-button size="mini" type="primary" @click="selectPop('疾病')">选择</el-button>
                  <el-button size="mini" type="danger" @click="clearhandleGetDisease">清除</el-button>
                </div>
              </div>

              <div style="display: flex;justify-content: space-around">
                <!--                无诊断病人-->
                <div class="content-item">
                  <div class="content-item-title">无诊断病人:</div>
                  <div class="content-item-component-checkbox">
                    <el-checkbox v-model="queryInfo.nodisPatientOut" true-label="1" false-label="">排除</el-checkbox>
                  </div>
                </div>
                <!--                死亡病人-->
                <div class="content-item">
                  <div class="content-item-title">死亡病人:</div>
                  <div class="content-item-component-checkbox">
                    <el-checkbox v-model="queryInfo.deathPatientOut" true-label="1" false-label="">排除</el-checkbox>
                  </div>
                </div>
                <!--                手术病人-->
                <div class="content-item">
                  <div class="content-item-title">手术病人:</div>
                  <div class="content-item-component-checkbox">
                    <el-checkbox v-model="queryInfo.operaPatientOut" true-label="1" false-label="">排除</el-checkbox>
                  </div>
                </div>
              </div>

              <!--              手术分类-->
              <div class="content-item">
                <div class="content-item-title">手术分类:</div>
                <div class="content-item-component">
                  <el-input v-model="queryInfo.operationTypeName" readonly="true" />
                </div>
                <div class="content-item-btns">
                  <el-button size="mini" type="primary" @click="selectPop('手术类型')">选择</el-button>
                  <el-button size="mini" type="danger" @click="clearhandleoperationType">清除</el-button>
                </div>
              </div>

              <!--                切口类型-->
              <div class="content-item">
                <div class="content-item-title">切口类型:</div>
                <div class="content-item-component-checkbox">
                  <el-checkbox v-model="queryInfo.incisionType0" true-label="1" false-label="">0类</el-checkbox>
                  <el-checkbox v-model="queryInfo.incisionType1" true-label="1" false-label="">Ⅰ类</el-checkbox>
                  <el-checkbox v-model="queryInfo.incisionType2" true-label="1" false-label="">Ⅱ类</el-checkbox>
                  <el-checkbox v-model="queryInfo.incisionType3" true-label="1" false-label="">Ⅲ类</el-checkbox>
                </div>
              </div>

            </div>
          </card>
        </div>
        <div class="right">
          <div class="right-top">
            <card>
              <div slot="cardHeader">药品相关</div>
              <div slot="cardBody">
                <!--                自定义药品-->
                <div class="content-item">
                  <div class="content-item-title">自定义药品:</div>
                  <div class="content-item-component">
                    <el-input v-model="queryInfo.drugTypeName" readonly="true" />
                  </div>
                  <div class="content-item-btns">
                    <el-button size="mini" type="primary" @click="selectPop('自定义药品属性')">选择</el-button>
                    <el-button size="mini" type="danger" @click="clearhandleGetDrugType"> 清除</el-button>
                  </div>
                </div>
                <!--                药品-->
                <div class="content-item">
                  <div class="content-item-title">药品:</div>
                  <div class="content-item-component">
                    <el-input v-model="queryInfo.uniqueCodeName" readonly="true" />
                  </div>
                  <div class="content-item-btns">
                    <el-button size="mini" type="primary" @click="selectPop('药品')">选择</el-button>
                    <el-button size="mini" type="danger" @click="clearhandleGetDrug">清除</el-button>
                  </div>
                </div>
                <!--                麻精药品-->
                <div class="content-item">
                  <div class="content-item-title">麻精药品:</div>
                  <div class="content-item-component-checkbox">
                    <el-checkbox v-model="queryInfo.MaZui" true-label="1" false-label="">麻醉药品</el-checkbox>
                    <el-checkbox v-model="queryInfo.JingYi" true-label="1" false-label="">精一药品</el-checkbox>
                    <el-checkbox v-model="queryInfo.JingEr" true-label="1" false-label="">精二药品</el-checkbox>
                  </div>
                </div>
                <!--                基本药物-->
                <div class="content-item">
                  <div class="content-item-title">基本药物:</div>
                  <div class="content-item-component-checkbox">
                    <el-checkbox v-model="queryInfo.baseDrug" true-label="1" false-label="">使用</el-checkbox>
                  </div>
                </div>
                <!--                药品类型-->
                <div class="content-item">
                  <div class="content-item-title">药品类型:</div>
                  <div class="content-item-component-checkbox">
                    <el-checkbox v-model="queryInfo.chineseDrug" true-label="1" false-label="">中成药</el-checkbox>
                    <el-checkbox v-model="queryInfo.chineseDrink" true-label="1" false-label="">中药饮片</el-checkbox>
                    <el-checkbox v-model="queryInfo.chemicalDrug" true-label="1" false-label="">化学药品</el-checkbox>
                    <el-checkbox v-model="queryInfo.biologicDrug" true-label="1" false-label="">生物制剂</el-checkbox>
                  </div>
                </div>
                <!--                抗菌药类型-->
                <div class="content-item">
                  <div class="content-item-title">抗菌药类型:</div>
                  <div class="content-item-component-checkbox">
                    <el-checkbox v-model="queryInfo.antiBacterial" true-label="1" false-label="">抗细菌药</el-checkbox>
                    <el-checkbox v-model="queryInfo.antiFungal" true-label="1" false-label="">抗真菌药</el-checkbox>
                    <el-checkbox v-model="queryInfo.antiTuberculotic" true-label="1" false-label="">抗结核/麻风药</el-checkbox>
                    <el-checkbox v-model="queryInfo.otherAnti" true-label="1" false-label="">其他抗菌药</el-checkbox>
                  </div>
                </div>
                <!--                抗菌药级别-->
                <div class="content-item">
                  <div class="content-item-title">抗菌药级别:</div>
                  <div class="content-item-component-checkbox">
                    <el-checkbox v-model="queryInfo.specialUse" true-label="1" false-label="">特殊使用</el-checkbox>
                    <el-checkbox v-model="queryInfo.limitedUse" true-label="1" false-label="">限制使用</el-checkbox>
                    <el-checkbox v-model="queryInfo.notLimitedUse" true-label="1" false-label="">非限制使用</el-checkbox>
                  </div>
                </div>
                <!--                给药途径-->
                <div class="content-item">
                  <div class="content-item-title">给药途径:</div>
                  <div class="content-item-component">
                    <el-input v-model="queryInfo.drugRouteName" readonly="true" />
                  </div>
                  <div class="content-item-btns">
                    <el-button size="mini" type="primary" @click="selectPop('给药途径')">选择</el-button>
                    <el-button size="mini" type="danger" @click="clearhandleGetRoute">清除</el-button>
                  </div>
                </div>

                <!--                抗精神病药-->
                <div class="content-item">
                  <div class="content-item-title">抗精神病药:</div>
                  <div class="content-item-component-radio">
                    <el-radio-group v-model="queryInfo.Spirit">
                      <el-radio :label="'1'">是</el-radio>
                      <el-radio :label="'0'">否</el-radio>
                    </el-radio-group>
                  </div>
                </div>
                <!--                抗抑郁药-->
                <div class="content-item">
                  <div class="content-item-title">抗抑郁药:</div>
                  <div class="content-item-component-radio">
                    <el-radio-group v-model="queryInfo.Depress">
                      <el-radio :label="'1'">是</el-radio>
                      <el-radio :label="'0'">否</el-radio>
                    </el-radio-group>
                  </div>
                </div>

                <!--                用药目的-->
                <div class="content-item">
                  <div class="content-item-title">用药目的:</div>
                  <div class="content-item-component-checkbox">
                    <el-checkbox v-model="queryInfo.Purpose3" true-label="1" false-label="">预防</el-checkbox>
                    <el-checkbox v-model="queryInfo.Purpose4" true-label="1" false-label="">治疗</el-checkbox>
                  </div>
                </div>
              </div></card>
          </div>
          <div class="right-bottom">
            <card>
              <div slot="cardHeader">抽样信息</div>
              <div slot="cardBody">
                <!--                 随机抽取-->
                <div class="sample-item">
                  <div class="sample-wrapper">
                    <div class="sample-item-left">
                      <el-checkbox v-model="queryInfo.isRandom" true-label="1" false-label="">随机抽取</el-checkbox>
                    </div>
                    <div class="sample-item-component">
                      <el-input v-model="queryInfo.randomCount" style="width: 140px" :disabled="disabledInput.isRandom" />
                    </div>
                    <div class="sample-item-right">份</div>
                  </div>
                  <div class="sample-wrapper">
                    <div class="sample-item-left">
                      <el-checkbox v-model="queryInfo.isRandomPercent" true-label="1" false-label="">随机抽取</el-checkbox>
                    </div>

                    <div class="sample-item-component">
                      <el-input v-model="queryInfo.randomPercent" style="width: 140px" :disabled="disabledInput.isRandomPercent" />
                    </div>
                    <div class="sample-item-right">%</div>
                  </div>
                </div>
                <!--                 每个科室-->
                <div class="sample-item">
                  <div class="sample-wrapper">
                    <div class="sample-item-left">
                      <el-checkbox v-model="queryInfo.isEachDeptCount" true-label="1" false-label="">每个科室</el-checkbox>
                    </div>

                    <div class="sample-item-component">
                      <el-input v-model="queryInfo.eachDeptCount" style="width: 140px" :disabled="disabledInput.isEachDeptCount" />
                    </div>
                    <div class="sample-item-right">份</div>
                  </div>
                  <div class="sample-wrapper">
                    <div class="sample-item-left">
                      <el-checkbox v-model="queryInfo.isEachDeptPercent" true-label="1" false-label="">每个科室</el-checkbox>
                    </div>
                    <div class="sample-item-component">
                      <el-input v-model="queryInfo.eachDeptPercent" style="width: 140px" :disabled="disabledInput.isEachDeptPercent" />
                    </div>
                    <div class="sample-item-right">%</div>
                  </div>
                </div>
                <!--                 等间隔抽取-->
                <div class="sample-item">
                  <div class="sample-wrapper">
                    <div class="sample-item-left">
                      <el-checkbox v-model="queryInfo.isEqualIntervalCount" true-label="1" false-label="">等间隔抽取</el-checkbox>
                    </div>
                    <div class="sample-item-component">
                      <el-input v-model="queryInfo.equalIntervalCount" style="width: 140px" :disabled="disabledInput.isEqualIntervalCount" />
                    </div>
                    <div class="sample-item-right">份</div>
                  </div>
                </div>
                <div class="sample-item-long">
                  <div class="sample-item-component">
                    <el-checkbox v-model="queryInfo.isDoctorName" true-label="1" false-label="" />
                    <el-input v-model="queryInfo.doctorNamePercent" style="width: 140px" :disabled="disabledInput.isDoctorName" />
                  </div>
                  <div class="sample-item-right">%处方医生,每位处方医生的</div>
                  <div class="sample-item-component">
                    <el-input v-model="queryInfo.doctorNameCount" style="width: 140px" :disabled="disabledInput.isDoctorName" />
                  </div>
                  <div class="sample-item-right">份</div>
                </div>

              </div>
            </card>
          </div>

        </div>
      </div>
    </div>

    <el-dialog
      title="提示"
      :visible.sync="dialogVisible"
      width="60%"
      @close="closeSaveTaskList"
    >
      <Bluetable
        :t-head="saveTaskListHead"
        :t-data="saveTaskList"
        @operateClick="operateClickSaveTaskList"
      />
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="closeSaveTaskList">确 定</el-button>
      </span>
    </el-dialog>

    <el-dialog
      title="任务计划"
      :visible.sync="taskListVisible"
      width="80%"
      @close="closeTaskListVisible"
    >
      <Bluetable
        :t-head="taskListHead"
        :t-data="taskListInfo"
      />
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="closeTaskListVisible">确 定</el-button>
      </span>
    </el-dialog>

    <Poptable
      ref="ptable"
      :p-type="pType"
      ctype="zy"
      :hospital-code="queryInfo.Hospital_Code"
      @handleGetDept="handleGetDept"
      @handleGetDoctor="handleGetDoctor"
      @handleGetDisease="handleGetDisease"
      @handleGetDrug="handleGetDrug"
      @handleGetRoute="handleGetRoute"
      @handleGetOperationType="handleGetOperationType"
      @handleGetDrugType="handleGetDrugType"
    />
  </div>
</template>

<script>
import Card from '../../childComps/card/Card'
import Poptable from '../../childComps/poptable'
import { GetSaveTaskList, DeleteTaskList, GetInpTaskData } from '@/api/prc17212'
export default {
  name: 'InpatientReview',
  components: { Card, Poptable },
  data() {
    return {
      UserCode: '001',
      presc_patList: [],
      pType: '11',
      queryInfo: {
        Hospital_Code: '0', // 医院编码
        templateId: '3', // 3
        startTime: '',
        endTime: '',
        LeaveHos: '',	// 出院
        InHos: '',	// 在院
        // Outp: '', // 门诊
        // Eme: '', // 急诊
        notComments: '', //	没有点评 必须是1是 没有为空
        notCommentsTrue: '', // 点评合理 必须是1是 没有为空
        notCommentsFalse: '', // 	点评不合理 必须是1是 没有为空
        commentsUser: '', // 点评人 必须是用户名称 没有为空
        depeCode: '', // 科室编码 没有为空
        depeName: '', // 科室名称 显示用
        doctorCode: '', // 	医生编码没有为空
        doctorName: '', // 	医生名称,显示用
        doctorAD: '', // 主治医师?
        doctorAP: '', // 副主任医?
        doctorCP: '', // 主任医师?
        doctorRD: '', // 住院医师?

        // allPresc: '', // 全部处方
        // notAntiPresc: '', // 非抗菌药物处方
        payClass: '', // 费别
        patientName: '', // 病人姓名
        feMale: '', // 女
        Male: '', // 	男
        inpNo: '', // 住院号

        Purpose3: '', // 预防
        Purpose4: '', // 治疗

        startAge: '', // 最小年龄 必须是 数字类型 没有为空
        endAge: '', // 最大年龄 必须是 数字类型 没有为空
        Disease: '', //	诊断名称 诊断编码 没有为空
        DiseaseName: '', //	诊断名称 显示
        // prescRuledOut: '', // 	无诊断处方 必须是1是 没有为空

        nodisPatientOut: '', // 无诊断病人排除
        deathPatientOut: '', // 死亡病人排除
        operaPatientOut: '', // 手术病人排除

        operationType: '', // 手术分类
        operationTypeName: '', // 手术分类显示

        incisionType0: '',
        incisionType1: '',
        incisionType2: '',
        incisionType3: '',

        drugTypeCode: '', // 自定义药品编码 没有为空
        drugTypeName: '', // 显示用
        uniqueCode: '', // 药品编码 没有为空
        uniqueCodeName: '', // 显示用
        MaZui: '', // 	麻醉 必须是1是 没有为空
        JingYi: '', // 精一 必须是1是 没有为空
        JingEr: '', // 精二 必须是1是 没有为空
        baseDrug: '', // 	基本药物 必须是1是 没有为空
        chineseDrug: '', //	中成药 必须是1是 没有为空
        chineseDrink: '', //	中药饮片 必须是1是 没有为空
        chemicalDrug: '', // 	化学药品 必须是1是 没有为空
        biologicDrug: '', // 生物制剂 必须是1是 没有为空
        antiBacterial: '', // 	抗细菌药 必须是1是 没有为空
        antiFungal: '', //	抗真菌 必须是1是 没有为空
        antiTuberculotic: '', // 抗结核/麻风 必须是1是 没有为空
        otherAnti: '', // 	其他抗菌药 必须是1是 没有为空
        specialUse: '', // 特殊使用 必须是1是 没有为空
        limitedUse: '', //	限制使用 必须是1是 没有为空
        notLimitedUse: '', // 	非限制使用 必须是1是 没有为空
        drugRoute: '', // ??????	给药途径 必须是1是 没有为空
        drugRouteName: '', // 显示

        // startCost: '', // 最小金额 必须是 浮点型数据类型 没有为空
        // endCost: '', // 	最大金额 必须是 浮点型数据类型 没有为空

        Spirit: '', // 	抗精神病药 必须是1是 0否 没有为空
        Depress: '', // 抗抑郁药品 必须是1是 0否 没有为空

        isRandom: '', //	是否选择随机抽取 必须是1是 0否
        randomCount: '', // 随机抽取份数 必须是 浮点型数据类型
        isRandomPercent: '', // 是否选择随机抽取百分比 必须是1是 0否
        randomPercent: '', // 随机抽取百分比 必须是 浮点型数据类型
        isEachDeptCount: '', // 是否选择每个科室 必须是1是 0否
        eachDeptCount: '', //	每个科室份数 必须是 浮点型数据类型
        isEachDeptPercent: '', //	是否选择每个科室百分比 必须是1是 0否
        eachDeptPercent: '', // 每个科室百分比 必须是 浮点型数据类型
        isEqualIntervalCount: '', //	是否选择等间隔抽取 必须是1是 0否
        equalIntervalCount: '', //	等间隔抽取份数 必须是 浮点型数据类型
        isDoctorName: '', // 是否选择处方医生 必须是1是 0否
        doctorNamePercent: '', //	处方医生百分比 必须是 浮点型数据类型
        doctorNameCount: '' //	处方医生份数 必须是 浮点型数据类型
      },
      disabledInput: {
        isRandom: true,
        isRandomPercent: true,
        isEachDeptCount: true,
        isEachDeptPercent: true,
        isEqualIntervalCount: true,
        isDoctorName: true
      },
      JsonValueTemp: {},
      saveTaskList: [],
      saveTaskListHead: [
        { operate: ['查看', '删除'], label: '操作', link: true, width: '100px' },
        { prop: 'id', label: 'ID' },
        { prop: 'tasktime', label: '分配时间' },
        { prop: 'username', label: '姓名' },
        { prop: 'tasknun', label: '点评数量' },
        { prop: 'taskname', label: '任务计划名称' },
        { prop: 'artificialnum', label: '已人工点评数量' }
      ],
      dialogVisible: false,

      taskListVisible: false,
      taskListHead: [
        { prop: 'clinicno', label: '门诊号' },
        { prop: 'patientname', label: '姓名' },
        { prop: 'sex', label: '性别' },
        { prop: 'age', label: '年龄' },
        { prop: 'deptname', label: '科室' },
        { prop: 'doctorname', label: '医生' },
        { prop: 'ordertime', label: '时间', width: '120px' },
        { prop: 'diseasename', label: '临床诊断' },
        { prop: 'payclass', label: '费别' },
        { prop: 'commentuser', label: '点评人' },
        { prop: 'commentresult', label: '点评结果' },
        { prop: 'commenttime', label: '点评时间' },
        { prop: 'commentsname', label: '点评结果' },
        { prop: 'ruleid', label: '点评点' },
        { prop: 'commentmode', label: '点评类型' },
        { prop: 'commentdrug', label: '点评药品' },
        { prop: 'drugtypecount', label: '药品种类' },
        { prop: 'antitypecount', label: '抗菌药种类' },
        { prop: 'specialantitypecount', label: '特抗种类' },
        { prop: 'injection', label: '注射剂' },
        { prop: 'basictypecount', label: '基药' },
        { prop: 'cost', label: '药品费用' },
        { prop: 'anticost', label: '抗菌药费用' },
        { prop: 'basecost', label: '基药费别' }
      ],
      taskListInfo: []
    }
  },
  watch: {
    'queryInfo.isRandom': {
      handler: function(val, oldVal) {
        this.disabledInput.isRandom = !(val === '1')
      },
      deep: true
    },
    'queryInfo.isRandomPercent': {
      handler: function(val, oldVal) {
        this.disabledInput.isRandomPercent = !(val === '1')
      },
      deep: true
    },

    'queryInfo.isEachDeptCount': {
      handler: function(val, oldVal) {
        this.disabledInput.isEachDeptCount = !(val === '1')
      },
      deep: true
    },

    'queryInfo.isEachDeptPercent': {
      handler: function(val, oldVal) {
        this.disabledInput.isEachDeptPercent = !(val === '1')
      },
      deep: true
    },

    'queryInfo.isEqualIntervalCount': {
      handler: function(val, oldVal) {
        this.disabledInput.isEqualIntervalCount = !(val === '1')
      },
      deep: true
    },
    'queryInfo.isDoctorName': {
      handler: function(val, oldVal) {
        this.disabledInput.isDoctorName = !(val === '1')
      },
      deep: true
    }

  },
  mounted() {
    const userInfo = localStorage.getItem('user')
    this.UserCode = JSON.parse(userInfo).user_no
    this.queryInfo.Hospital_Code = JSON.parse(userInfo).his_code
  },
  activated() {
    const userInfo = localStorage.getItem('user')
    this.UserCode = JSON.parse(userInfo).user_no
    this.queryInfo.Hospital_Code = JSON.parse(userInfo).his_code
  },
  methods: {

    // 筛选
    async getPrescPatList() {
      if (this.queryInfo.startTime === '') {
        this.$message({
          message: '请选择开始时间',
          type: 'warning'
        })
        this.$refs.startTime.focus()
      } else if (this.queryInfo.endTime === '') {
        this.$message({
          message: '请选择结束时间',
          type: 'warning'
        })
        this.$refs.endTime.focus()
      } else {
        this.JsonValueTemp = JSON.parse(JSON.stringify(this.queryInfo))
        for (var key in this.JsonValueTemp) {
          if (key === 'isRandom' || key === 'randomCount' || key === 'isRandomPercent' ||
              key === 'randomPercent' || key === 'isEachDeptCount' || key === 'eachDeptCount' ||
              key === 'isEachDeptPercent' || key === 'eachDeptPercent' || key === 'isEqualIntervalCount' ||
              key === 'equalIntervalCount' || key === 'isDoctorName' || key === 'doctorNamePercent' ||
              key === 'doctorNameCount') {
            continue
          }
          // if (this.JsonValueTemp[key] === '') {
          //   delete this.JsonValueTemp[key]
          // }
          if (key === 'depeName' || key === 'doctorName' || key === 'DiseaseName' ||
              key === 'drugTypeName' || key === 'uniqueCodeName' || key === 'drugRouteName' || key === 'operationTypeName') {
            delete this.JsonValueTemp[key]
          }
        }
        this.toPrescpatlist()
      }
    },

    // 获取任务计划
    async GetSaveTaskList() {
      const tempJson = {
        UserCode: this.UserCode,
        templateId: this.queryInfo.templateId
      }
      await GetSaveTaskList({
        UserCode: tempJson.UserCode,
        templateId: tempJson.templateId
      }).then(res => {
        console.log(res)
        if (res.code === 200) {
          this.saveTaskList = res.data
        }
      }).catch(err => {
        console.log(err)
      })
    },
    // 任务计划 查看 删除
    operateClickSaveTaskList(val, row) {
      if (val === '查看') {
        this.GetTaskData(row.id)
      } else if (val === '删除') {
        this.DeleteTaskList(row.id)
      }
    },
    showTaskListVisible() {
      this.taskListVisible = true
    },
    closeTaskListVisible() {
      this.taskListVisible = false
      this.taskListInfo = []
    },
    // 删除
    async DeleteTaskList(Id) {
      await DeleteTaskList({
        Id: Id
      }).then(res => {
        if (res.code === 200) {
          this.$message({
            message: '删除成功',
            type: 'success'
          })
        } else {
          this.$message.error('删除失败')
        }
        this.closeSaveTaskList()
      }).catch(err => {
        console.log(err)
      })
    },
    // 查看
    async GetTaskData(Id) {
      await GetInpTaskData({
        Id: Id,
        templateId: this.queryInfo.templateId
      }).then(res => {
        if (res.code === 200) {
          this.taskListInfo = res.data
          this.showTaskListVisible()
        }
      }).catch(err => {
        console.log(err)
      })
    },

    showSaveTaskList() {
      this.dialogVisible = true
      this.GetSaveTaskList()
    },
    closeSaveTaskList() {
      this.dialogVisible = false
      this.saveTaskList = []
    },

    toPrescpatlist() {
      this.$router.push({ path: '/prc/prchospitalreviews/prescpatlist', query: { JsonValueTemp: this.JsonValueTemp }})
    },
    selectPop(val) {
      this.$refs.ptable.show()
      this.pType = val
    },
    // 科室
    handleGetDept(data) {
      var names = []; var codes = []
      for (var i = 0; i < data.length; i++) {
        names.push(data[i].deptname)
        codes.push(data[i].deptcode)
      }
      this.queryInfo.depeName = names.join(',')
      this.queryInfo.depeCode = codes.join(',')
    },
    clearhandleGetDept() {
      this.queryInfo.depeName = ''
      this.queryInfo.depeCode = ''
      this.$refs.ptable.clearSelect()
    },
    // 医生
    handleGetDoctor(data) {
      var names = []; var codes = []
      for (var i = 0; i < data.length; i++) {
        names.push(data[i].doctorname)
        codes.push(data[i].doctorcode)
      }
      this.queryInfo.doctorName = names.join(',')
      this.queryInfo.doctorCode = codes.join(',')
    },
    clearhandleGetDoctor() {
      this.queryInfo.doctorName = ''
      this.queryInfo.doctorCode = ''
      this.$refs.ptable.clearSelect()
    },
    // 诊断
    handleGetDisease(data) {
      var names = []; var codes = []
      for (var i = 0; i < data.length; i++) {
        names.push(data[i].disname)
        codes.push(data[i].discode)
      }
      this.queryInfo.DiseaseName = names.join(',')
      this.queryInfo.Disease = codes.join(',')
    },
    clearhandleGetDisease() {
      this.queryInfo.DiseaseName = ''
      this.queryInfo.Disease = ''
      this.$refs.ptable.clearSelect()
    },
    // 药品
    handleGetDrug(data) {
      var names = []; var codes = []
      for (var i = 0; i < data.length; i++) {
        names.push(data[i].drugname)
        codes.push(data[i].uniquecode)
      }
      this.queryInfo.uniqueCodeName = names.join(',')
      this.queryInfo.uniqueCode = codes.join(',')
    },
    handleGetDrugType(data) {
      var names = []; var codes = []
      for (var i = 0; i < data.length; i++) {
        names.push(data[i].typename)
        codes.push(data[i].typecode)
      }
      this.queryInfo.drugTypeName = names.join(',')
      this.queryInfo.drugTypeCode = codes.join(',')
    },
    clearhandleGetDrugType() {
      this.queryInfo.drugTypeName = ''
      this.queryInfo.drugTypeCode = ''
      this.$refs.ptable.clearSelect()
    },
    clearhandleGetDrug() {
      this.queryInfo.uniqueCodeName = ''
      this.queryInfo.uniqueCode = ''
      this.$refs.ptable.clearSelect()
    },
    // 给药途径
    handleGetRoute(data) {
      var names = []; var codes = []
      for (var i = 0; i < data.length; i++) {
        names.push(data[i].routename)
        codes.push(data[i].routecode)
      }
      this.queryInfo.drugRouteName = names.join(',')
      this.queryInfo.drugRoute = codes.join(',')
    },
    clearhandleGetRoute() {
      this.queryInfo.drugRouteName = ''
      this.queryInfo.drugRoute = ''
      this.$refs.ptable.clearSelect()
    },
    // 住院号
    clearhandleinpNo() {
      this.queryInfo.inpNo = ''
    },
    handleGetOperationType(data) {
      var names = []; var codes = []
      for (var i = 0; i < data.length; i++) {
        names.push(data[i].typename)
        codes.push(data[i].typecode)
      }
      this.queryInfo.operationTypeName = names.join(',')
      this.queryInfo.operationType = codes.join(',')
    },
    clearhandleoperationType() {
      this.queryInfo.operationTypeName = ''
      this.queryInfo.operationType = ''
      this.$refs.ptable.clearSelect()
    }
  }
}
</script>

<style scoped lang="scss">
  body{
    background:#e6edf5;
  }
  .wrapper{
    width: 100%;
    height: 100%;
    font-size: 12px;
    .main-message{
      background-color: #E6EDF5;
      padding-left: 20px;
      .btn-layout{
        padding: 10px 0;
        .el-button{
          margin-right: 20px;
        }
      }
      .card-layout{
        display: flex;
        flex-wrap: wrap;
        .left{
          flex: 1;
          min-width: 540px;
          padding-right: 20px;
          padding-bottom: 20px;
        }
        .right{
          padding-right: 20px;
          min-width: 540px;
          flex: 1;
          .right-bottom{
            margin-top: 20px;
          }
        }
      }
    }
  }
  .content-item{
    display: flex;
    margin-bottom: 5px;
    .content-item-title{
      width: 80px;
      line-height: 40px;
      text-align: right;
    }
    .content-item-component{
      margin-left: 5px;
    }
    .content-item-component-checkbox{
      margin-left: 5px;
      line-height: 40px;
    }
    .content-item-component-radio{
      margin-left: 5px;
      line-height: 40px;
    }
    .content-item-btns{
      margin-left: 10px;
      display: flex;
      align-items: center;
      .el-button{
        width: 56px;
        height: 28px;
        margin-right: 10px;
      }
    }
  }
  .sample-item{
    display: flex;
    margin-bottom: 5px;
  }
  .sample-wrapper{
    flex: 1;
    font-size: 12px;
    display: flex;
    .sample-item-left{
      width: 100px;
      line-height: 40px;
    }
    .sample-item-component{

    }
    .sample-item-right{
      line-height: 40px;
      padding-left: 5px;
      padding-right: 20px;
    }
  }
  .sample-item-long{
    font-size: 12px;
    display: flex;
    flex: 1;
    .sample-item-right{
      padding: 0 5px;
      line-height: 40px;
    }
    .sample-item-right{
      padding-right: 5px;
    }
  }

  /deep/.el-input{
    width:300px;
    height:40px;
    border-radius:4px;
    padding-left:5px;
    font-size: 12px;
  }
  /deep/.el-radio-group{
    margin-left: 5px;
  }
  /deep/.el-checkbox__label{
    width: 100px;
  }
  /deep/.el-checkbox{
    margin-left: 5px;
    margin-right: 0;
  }
  /deep/.el-checkbox__label{
    font-size: 12px;
  }
  /deep/.el-radio__label{
    font-size: 12px;
    width: 100px;
  }
  /deep/.el-radio{
    margin-right: 50px;
  }

</style>
